<?php
/**
 * Created by PhpStorm.
 * User: July
 * Date: 2019/3/13
 * Time: 15:45
 * 创建优惠券表单
 */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;

$this->title = '创建优惠券';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="site-contact">
    <h1><?= Html::encode($this->title) ?></h1>
        <div class="row">
            <div class="col-lg-12">
                <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
                <h3 style="color: red;">必填字段</h3>
                <?= $form->field($model, 'card_name', ['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'卡券名称']) ?>
                <?= $form->field($model, 'card_type', ['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->dropDownList($card_type_list, ['prompt'=>'--请选择--']) ?>
                <?= $form->field($model, 'deal_detail',['options'=>['class'=>'deal_detail']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'least_cost',['options'=>['class'=>'least_cost']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'reduce_cost',['options'=>['class'=>'reduce_cost']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'discount',['options'=>['class'=>'discount']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'gift',['options'=>['class'=>'gift']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'default_detail',['options'=>['class'=>'default_detail']])->textInput()->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'logo_url')->textInput(['placeholder'=>'必须是上传到微信服务器的地址，建议像素为300*300']) ?>
                <?= $form->field($model, 'brand_name',['options'=>['style'=>'width:49%;float:left;']])->textInput(['maxlength' => 12,'placeholder'=>'商户名字,字数上限为12个汉字']) ?>
                <?= $form->field($model, 'code_type',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->dropDownList($code_type_list, ['prompt'=>'--请选择--']) ?>
                <?= $form->field($model, 'title',['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'卡券名，字数上限为9个汉字']) ?>
                <?= $form->field($model, 'color',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->dropDownList($color_list, ['prompt'=>'--请选择--']) ?>
                <?= $form->field($model, 'notice',['options'=>['style'=>'width:49%;']])->textInput(['maxlength' => 16,'placeholder'=>'卡券使用提醒，字数上限为16个汉字']) ?>
                <?= $form->field($model, 'description')->textInput(['placeholder'=>'使用说明']) ?>
                <?= $form->field($model, 'date_type',['options'=>['style'=>'width:49%;float:left;']])->dropDownList(['DATE_TYPE_FIX_TERM' => '固定时长', 'DATE_TYPE_FIX_TIME_RANGE' => '固定日期区间'], ['prompt'=>'--请选择--']) ?>
                <?= $form->field($model, 'fixed_term',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'自领取后多少天内有效'])->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'fixed_begin_term',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'自领取后多少天开始生效'])->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'begin_timestamp',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'卡券起用时间'])->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'end_timestamp',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'卡券过期时间'])->hiddenInput()->label(false); ?>
                <?= $form->field($model, 'quantity',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'库存数量，最多1亿']) ?>
                <?= $form->field($model, 'get_limit',['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'每人可领券的数量限制']) ?>
                <?= $form->field($model, 'use_limit',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->textInput(['placeholder'=>'每人可核销的数量限制']) ?>
                <?= $form->field($model, 'center_title',['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'卡券顶部居中的按钮文字内容，例如：立即使用']) ?>
                <?= $form->field($model, 'center_sub_title',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->textInput(['placeholder'=>'显示在入口下方的提示语，例如：立即享受优惠']) ?>
                <?= $form->field($model, 'center_url',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'顶部居中的url']) ?>
                <h3 style="color: red;">非必填字段</h3>
                <?= $form->field($model, 'service_phone',['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'客服电话号码']) ?>
                <?= $form->field($model, 'can_share',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->dropDownList([1=>'可以分享', 0=>'不可以分享']) ?>
                <?= $form->field($model, 'can_give_friend',['options'=>['style'=>'width:49%;float:left;']])->dropDownList([1=>'可以转赠', 0=>'不可以转赠']) ?>
                <?= $form->field($model, 'custom_url_name',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->textInput(['placeholder'=>'自定义跳转外链的入口名字，例如：立即使用']) ?>
                <?= $form->field($model, 'custom_url_sub_title',['options'=>['style'=>'width:49%;float:left;']])->textInput(['placeholder'=>'显示在入口右侧的提示语,，例如：更多惊喜']) ?>
                <?= $form->field($model, 'custom_url',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->textInput(['placeholder'=>'自定义跳转的url']) ?>
                <?= $form->field($model, 'promotion_url_name',['options'=>['style'=>'width:49%;float:left;']])->textInput(['maxlength'=>5,'placeholder'=>'营销场景的自定义入口名称，例如：产品介绍']) ?>
                <?= $form->field($model, 'promotion_url_sub_title',['options'=>['style'=>'width:49%;float:left;margin-left:2%;']])->textInput(['placeholder'=>'显示在营销入口右侧的提示语']) ?>
                <?= $form->field($model, 'promotion_url',['options'=>['style'=>'width:49%;']])->textInput(['placeholder'=>'入口跳转外链的地址链接']) ?>

                <h3 style="color: red;">发放配置</h3>
                <?= $form->field($model, 'business_type',['options'=>['style'=>'width:49%;']])->radioList(['1'=>'线上', '2'=>'线下']) ?>
                <?= $form->field($model, 'apply_stores',['options'=>['style'=>'width:49%;']])->textInput(['type'=>'hidden']) ?>
                <?= Html::Button('点击选择', ['class' => 'btn btn-primary', 'id'=>'select-stores']) ?>
                <?= $form->field($model, 'apply_goods',['options'=>['style'=>'width:49%;']])->textInput(['type'=>'hidden']) ?>
                <?= Html::Button('点击选择', ['class' => 'btn btn-primary', 'id'=>'select-goods']) ?>
                <div class="form-group" style="padding-top: 10px;">
                    <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
                </div>
                <?php ActiveForm::end(); ?>
            </div>
        </div>
</div>